package com.meritdata.cloud.data.service.development.repository;

import com.meritdata.cloud.data.service.development.model.TdDataApiParameter;
import com.meritdata.cloud.data.service.development.model.TdDataApiTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import javax.transaction.Transactional;
import java.util.Date;

public interface IDataApiTableDao extends JpaRepository<TdDataApiTable,Long>, QuerydslPredicateExecutor<TdDataApiTable> {
    @Modifying
    @Transactional
    @Query("update TdDataApiTable as c set c.tableId=:tableId ,c.updateTime=:updateTime where c.id=:id")
    public int update(Long id, Long tableId, Date updateTime);

    @Modifying
    @Transactional
    @Query("delete from  TdDataApiTable as c  where c.apiId=:apiId")
    public int deleteByApiId(Long apiId);
}
